home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Business Heaven
/
Business Heaven.iso
/
accnting
/
pdquote
/
convert1.bas
< prev
next >
Wrap
BASIC Source File
|
1991-05-01
|
1KB
|
28 lines
10 'Program CONVERT.BAS to add the decimal point to the US-04 file
20 KEY OFF:CLS:EA$="EA"
30 INPUT "Enter the Supplier Code to be added to each record";SUPPLIER$
40 'The above line for another customer that wanted to add a fixed Supplier Code
50 OPEN "A:PLUMDATAD" FOR INPUT AS #1
60 ' ^--- Type drive letter and colon (":") ahead of the input file name if the input file is in some other than the DOS default drive.
70 OPEN "PLUMDATA.PRN" FOR OUTPUT AS #2
80 ' ^-------^---- Name the output file anything you wish.
90 LINE INPUT #1, ITEM$ 'Throw away the first line if it is a header
100 WHILE NOT EOF(1)
110 LINE INPUT #1, ITEM$
120 MATLCODE$ = LEFT$(ITEM$,12)
130 PARTDESC$ = MID$(ITEM$,14,30):Y = 0
140 X = INSTR(10,PARTDESC$," ") : IF X > 0 AND X <= 16 THEN Y = 1 : GOTO 180
150 X = INSTR(10,PARTDESC$,")") : IF X > 0 AND X <=16 THEN GOTO 180
160 X = INSTR(1,PARTDESC$," ") : IF X > 0 AND X <=16 THEN Y = 1 : GOTO 180
170 X = 16
180 PARTNUM$ = LEFT$(PARTDESC$,X - Y):DESCRIPT$ = MID$(PARTDESC$,X+1)
190 DESCRIPT$ = MID$(PARTDESC$,X+1)
200 UNITPRICE$ = MID$(ITEM$,58,7)
210 UNITPRICE = VAL(UNITPRICE$)/100 'Convert to numeric variable
220 WRITE #2, MATLCODE$;PARTNUM$;DESCRIPT$;UNITPRICE;SUPPLIER$;EA$
230 PRINT MATLCODE$;TAB(14);PARTNUM$;TAB(33);DESCRIPT$;TAB(60);UNITPRICE;TAB(72)SUPPLIER$
240 WEND
250 CLOSE #1
260 CLOSE #2
270 SYSTEM